#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>

struct ListNode {
    int val;
    struct ListNode* next;   
};
struct ListNode* reverseList(struct ListNode* head) {
    struct ListNode* n1, * n2, * n3;
    if (head == NULL)
        return  NULL;
    n1 = NULL;
    n2 = head;
    n3 = head->next;

    while (n2)
    {
        n2->next = n1;
        n1 = n2;
        n2 = n3;
        if (n3)
            n3 = n3->next;
    }
    return n1;
}
int main()
{  
    /*struct ListNode* node = (struct ListNode*)malloc(sizeof(struct ListNode));*/
    /*struct ListNode* node1 = (struct ListNode*)malloc(sizeof(struct ListNode));
    struct ListNode* node2= (struct ListNode*)malloc(sizeof(struct ListNode));
    struct ListNode* node3 = (struct ListNode*)malloc(sizeof(struct ListNode));*/
    /*if (node)
    {
        node->val = 1;
        node->next = node1;
    }
    
    node1->val = 2;
    node1->next = node2;
    node2->val = 3;
    node2->next = node3;
    node3->val = 4;
    reverseList(node);
    if (node)
    {
        free(node);
        node = NULL;
    }
    */

	return 0;
}
